using System.IO;
using Jurassic.Library;

namespace Kiwi.Node.Modules.Builtin
{
    public class WritableStream: BuiltinModuleObject
    {
        public TextWriter Writer { get; private set; }

        public WritableStream(IApplication application, TextWriter writer) : base(application)
        {
            Writer = writer;

            this["writable"] = true;
        }

        [JSFunction(Name = "write")]
        public void Write(string text)
        {
            Writer.Write(text);
        }
    }
}